home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Toolbox / Visual Basic Toolbox (P.I.E.)(1996).ISO / pgm_ctrl / cuactrls / cspin.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1995-05-22  |  9.2 KB  |  290 lines

  1. VERSION 2.00
  2. Begin Form frmSpin 
  3.    BackColor       =   &H00C0C0C0&
  4.    BorderStyle     =   3  'Fixed Double
  5.    Caption         =   "Spin Button Demo"
  6.    ClientHeight    =   2205
  7.    ClientLeft      =   1500
  8.    ClientTop       =   2475
  9.    ClientWidth     =   4710
  10.    ClipControls    =   0   'False
  11.    Height          =   2610
  12.    Icon            =   0
  13.    Left            =   1440
  14.    LinkTopic       =   "Form1"
  15.    ScaleHeight     =   2205
  16.    ScaleWidth      =   4710
  17.    Top             =   2130
  18.    Width           =   4830
  19.    Begin CUAEdit CUAEdit1 
  20.       BorderStyle     =   3  'Inset
  21.       FontBold        =   0   'False
  22.       FontItalic      =   0   'False
  23.       FontName        =   "MS Sans Serif"
  24.       FontSize        =   8.25
  25.       FontStrikethru  =   0   'False
  26.       FontUnderline   =   0   'False
  27.       Height          =   285
  28.       Left            =   3510
  29.       TabIndex        =   16
  30.       Top             =   1740
  31.       Width           =   315
  32.    End
  33.    Begin CUASpin CUASpin1 
  34.       Buddy           =   "CUAEdit1"
  35.       Height          =   285
  36.       Left            =   3840
  37.       TabIndex        =   15
  38.       Top             =   1740
  39.       Width           =   195
  40.    End
  41.    Begin CUACommand cmdOK 
  42.       Caption         =   "OK"
  43.       Default         =   -1  'True
  44.       Height          =   345
  45.       Left            =   3315
  46.       StandardButton  =   1  'OK
  47.       TabIndex        =   1
  48.       Top             =   120
  49.       Width           =   1260
  50.    End
  51.    Begin CUAFrame grp2 
  52.       BackColor       =   &H00C0C0C0&
  53.       BorderStyle     =   5  'Dip
  54.       Caption         =   "Date and time"
  55.       Height          =   840
  56.       Left            =   165
  57.       TabIndex        =   2
  58.       Top             =   735
  59.       Width           =   4155
  60.       Begin CUASpin spnTime 
  61.          Height          =   285
  62.          Index           =   0
  63.          Left            =   2520
  64.          Max             =   23
  65.          TabIndex        =   4
  66.          Top             =   300
  67.          Width           =   195
  68.          Wrap            =   -1  'True
  69.       End
  70.       Begin CUASpin spnTime 
  71.          Height          =   285
  72.          Index           =   1
  73.          Left            =   3105
  74.          Max             =   59
  75.          TabIndex        =   6
  76.          Top             =   300
  77.          Width           =   195
  78.          Wrap            =   -1  'True
  79.       End
  80.       Begin CUASpin spnTime 
  81.          Height          =   285
  82.          Index           =   2
  83.          Left            =   3690
  84.          Max             =   59
  85.          TabIndex        =   8
  86.          Top             =   300
  87.          Width           =   195
  88.          Wrap            =   -1  'True
  89.       End
  90.       Begin CUAEdit txtTime 
  91.          BorderStyle     =   3  'Inset
  92.          FontBold        =   0   'False
  93.          FontItalic      =   0   'False
  94.          FontName        =   "MS Sans Serif"
  95.          FontSize        =   8.25
  96.          FontStrikethru  =   0   'False
  97.          FontUnderline   =   0   'False
  98.          Height          =   285
  99.          Index           =   0
  100.          Left            =   2175
  101.          TabIndex        =   3
  102.          Text            =   "00"
  103.          Top             =   300
  104.          Width           =   330
  105.       End
  106.       Begin CUAEdit txtTime 
  107.          BorderStyle     =   3  'Inset
  108.          FontBold        =   0   'False
  109.          FontItalic      =   0   'False
  110.          FontName        =   "MS Sans Serif"
  111.          FontSize        =   8.25
  112.          FontStrikethru  =   0   'False
  113.          FontUnderline   =   0   'False
  114.          Height          =   285
  115.          Index           =   1
  116.          Left            =   2760
  117.          TabIndex        =   5
  118.          Text            =   "00"
  119.          Top             =   300
  120.          Width           =   330
  121.       End
  122.       Begin CUAEdit txtTime 
  123.          BorderStyle     =   3  'Inset
  124.          FontBold        =   0   'False
  125.          FontItalic      =   0   'False
  126.          FontName        =   "MS Sans Serif"
  127.          FontSize        =   8.25
  128.          FontStrikethru  =   0   'False
  129.          FontUnderline   =   0   'False
  130.          Height          =   285
  131.          Index           =   2
  132.          Left            =   3345
  133.          TabIndex        =   7
  134.          Text            =   "00"
  135.          Top             =   300
  136.          Width           =   330
  137.       End
  138.       Begin CUAEdit txtDate 
  139.          BorderStyle     =   3  'Inset
  140.          FontBold        =   0   'False
  141.          FontItalic      =   0   'False
  142.          FontName        =   "MS Sans Serif"
  143.          FontSize        =   8.25
  144.          FontStrikethru  =   0   'False
  145.          FontUnderline   =   0   'False
  146.          Height          =   285
  147.          Index           =   0
  148.          Left            =   120
  149.          TabIndex        =   9
  150.          Text            =   "94"
  151.          Top             =   315
  152.          Width           =   330
  153.       End
  154.       Begin CUASpin spnDate 
  155.          Height          =   285
  156.          Index           =   0
  157.          Left            =   465
  158.          Max             =   99
  159.          TabIndex        =   10
  160.          Top             =   315
  161.          Width           =   195
  162.          Wrap            =   -1  'True
  163.       End
  164.       Begin CUAEdit txtDate 
  165.          BorderStyle     =   3  'Inset
  166.          FontBold        =   0   'False
  167.          FontItalic      =   0   'False
  168.          FontName        =   "MS Sans Serif"
  169.          FontSize        =   8.25
  170.          FontStrikethru  =   0   'False
  171.          FontUnderline   =   0   'False
  172.          Height          =   285
  173.          Index           =   1
  174.          Left            =   705
  175.          TabIndex        =   11
  176.          Text            =   "01"
  177.          Top             =   315
  178.          Width           =   330
  179.       End
  180.       Begin CUASpin spnDate 
  181.          Height          =   285
  182.          Index           =   1
  183.          Left            =   1050
  184.          Max             =   12
  185.          Min             =   1
  186.          TabIndex        =   12
  187.          Top             =   315
  188.          Width           =   195
  189.          Wrap            =   -1  'True
  190.       End
  191.       Begin CUAEdit txtDate 
  192.          BorderStyle     =   3  'Inset
  193.          FontBold        =   0   'False
  194.          FontItalic      =   0   'False
  195.          FontName        =   "MS Sans Serif"
  196.          FontSize        =   8.25
  197.          FontStrikethru  =   0   'False
  198.          FontUnderline   =   0   'False
  199.          Height          =   285
  200.          Index           =   2
  201.          Left            =   1290
  202.          TabIndex        =   13
  203.          Text            =   "20"
  204.          Top             =   315
  205.          Width           =   330
  206.       End
  207.       Begin CUASpin spnDate 
  208.          Height          =   285
  209.          Index           =   2
  210.          Left            =   1635
  211.          Max             =   31
  212.          Min             =   1
  213.          TabIndex        =   14
  214.          Top             =   315
  215.          Width           =   195
  216.          Wrap            =   -1  'True
  217.       End
  218.    End
  219.    Begin Timer Timer1 
  220.       Interval        =   1000
  221.       Left            =   4350
  222.       Top             =   675
  223.    End
  224.    Begin CUALabel lbl 
  225.       Caption         =   "It can easily be connected with other controls, using the 'Buddy' property:"
  226.       FontBold        =   0   'False
  227.       FontItalic      =   0   'False
  228.       FontName        =   "MS Sans Serif"
  229.       FontSize        =   8.25
  230.       FontStrikethru  =   0   'False
  231.       FontUnderline   =   0   'False
  232.       ForeColor       =   &H00000080&
  233.       Height          =   450
  234.       Index           =   0
  235.       Left            =   180
  236.       TabIndex        =   17
  237.       Top             =   1665
  238.       Width           =   3105
  239.    End
  240.    Begin CUALabel lbl 
  241.       Caption         =   "Spin buttons are used in conjunction with other components, to increase/decrease a value in the ""buddy"" component."
  242.       FontBold        =   0   'False
  243.       FontItalic      =   0   'False
  244.       FontName        =   "MS Sans Serif"
  245.       FontSize        =   8.25
  246.       FontStrikethru  =   0   'False
  247.       FontUnderline   =   0   'False
  248.       ForeColor       =   &H00000080&
  249.       Height          =   615
  250.       Index           =   6
  251.       Left            =   180
  252.       TabIndex        =   0
  253.       Top             =   120
  254.       Width           =   3000
  255.    End
  256. Option Explicit
  257. Dim TimeDateHasFocus As Integer
  258. Sub cmdOK_Click ()
  259.    Unload Me
  260. End Sub
  261. Sub spnDate_Change (Index As Integer)
  262.    txtDate(Index) = Format$(spnDate(Index), "00")
  263. End Sub
  264. Sub spnTime_Change (Index As Integer)
  265.    txtTime(Index) = Format$(spnTime(Index), "00")
  266. End Sub
  267. Sub Timer1_Timer ()
  268.    Dim D
  269.    If TimeDateHasFocus Then Exit Sub
  270.    D = Now
  271.    spnTime(0) = Hour(D)
  272.    spnTime(1) = Minute(D)
  273.    spnTime(2) = Second(D)
  274.    spnDate(0) = Year(D) - 1900
  275.    spnDate(1) = Month(D)
  276.    spnDate(2) = Day(D)
  277. End Sub
  278. Sub txtDate_GotFocus (Index As Integer)
  279.    TimeDateHasFocus = True
  280. End Sub
  281. Sub txtDate_LostFocus (Index As Integer)
  282.    TimeDateHasFocus = False
  283. End Sub
  284. Sub txtTime_GotFocus (Index As Integer)
  285.    TimeDateHasFocus = True
  286. End Sub
  287. Sub txtTime_LostFocus (Index As Integer)
  288.    TimeDateHasFocus = False
  289. End Sub
  290.